/**
 *
 */
package com.zhuoyue.zhtj.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eit.eitsite.common.persistence.Page;
import com.eit.eitsite.common.service.CrudService;
import com.zhuoyue.zhtj.entity.Memo;
import com.zhuoyue.zhtj.dao.MemoDao;

/**
 * 备忘录Service
 *
 * @author hss
 * @version 2017-09-02
 */
@Service
@Transactional(readOnly = true)
public class MemoService extends CrudService<MemoDao, Memo> {
    @Autowired
    private MemoDao memoDao;

    public Memo get(String id) {
        return super.get(id);
    }

    public List<Memo> findList(Memo memo) {
        return super.findList(memo);
    }

    public Page<Memo> findPage(Page<Memo> page, Memo memo) {
        return super.findPage(page, memo);
    }

    @Transactional(readOnly = false)
    public void save(Memo memo) {
        super.save(memo);
    }

    @Transactional(readOnly = false)
    public void delete(Memo memo) {
        super.delete(memo);
    }

    @Transactional
    public boolean saveMemo(Memo memo) {
        int row = memoDao.insert(memo);
        if (row > 0) {
            return true;
        }
        return false;
    }

    @Transactional(readOnly = false)
    public boolean deleteMemo(Memo memo){
        int row =memoDao.delete(memo);
        if(row>0){
            return true;
        }
        return false;
    }
}